package com.pww.movie.domain.DTO;

import com.pww.movie.domain.PO.Media;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.beans.BeanUtils;

@Data
@EqualsAndHashCode(callSuper = true)
public class MediaDto extends Media {

    /**
     * 用户是否点赞/喜欢此媒体
     */
    private Boolean liked;

    /**
     * 构造函数：仅拷贝 Media，不设置 liked
     * 默认 liked 为 false
     *
     * @param media
     */
    public MediaDto(Media media) {
        this(media, false);
    }

    /**
     * 构造函数：拷贝 Media 并设置 liked
     *
     * @param media
     * @param liked
     */
    public MediaDto(Media media, Boolean liked) {
        BeanUtils.copyProperties(media, this);
        this.liked = liked;
    }
}
